import request from '@/utils/request.js'

export function getArticleList (params) {
  return request({
    url: '/v1_1/articles',
    method: 'GET',
    params
  })
}

export function getArticleById (articleId) {
  return request({
    url: '/v1_0/articles/' + articleId,
    method: 'get'
  })
}

export function deleteCollectArticle (articleId) {
  return request({
    url: '/v1_0/article/collections/' + articleId,
    method: 'DELETE'
  })
}

export function addCollectArticle (target) {
  return request({
    url: '/v1_0/article/collections',
    method: 'POST',
    data: {
      target
    }
  })
}

export function deleteLikeArticle (articleId) {
  return request({
    url: '/v1_0/article/likings/' + articleId,
    method: 'DELETE'
  })
}

export function addLikeArticle (target) {
  return request({
    url: '/v1_0/article/likings',
    method: 'POST',
    data: {
      target
    }
  })
}
